from esp_toytrain_client import ESPObject
IP = "192.168.73.31"

esp = ESPObject(IP, 80)

while 1:
    speed = input(">>").strip()
    if speed.isdigit():
        esp.set_speed(speed_val:=(int(speed)-5)*250)
        print(f"speed set to {speed_val}")
    else:
        print(f"invalid value {speed}")